//
//  DialogUtil.m
//  FireFightingApp
//
//  Created by 师shijing on 2017/6/22.
//  Copyright © 2017年 师shijing. All rights reserved.
//

#import "DialogUtil.h"

@implementation DialogUtil

+(void)setDefaultDialog{
    [SVProgressHUD setDefaultMaskType:SVProgressHUDMaskTypeClear];
    [SVProgressHUD setDefaultStyle:SVProgressHUDStyleLight];
    
}

+(void)showDialog{
    [self setDefaultDialog];
    [SVProgressHUD show];
}
+(void)showDialogNotAllowUser{
    [self setDefaultDialog];
    [SVProgressHUD setDefaultMaskType:SVProgressHUDMaskTypeClear];
    [SVProgressHUD show];
}

+(void)showDialogWithMessage:(NSString *)msg{
    [self setDefaultDialog];
    [SVProgressHUD showWithStatus:msg];
}
+(void)showDialogNotAllowUserWithMessage:(NSString *)msg{
    [self setDefaultDialog];
    [SVProgressHUD setDefaultMaskType:SVProgressHUDMaskTypeClear];
    [SVProgressHUD showWithStatus:msg];
}

+(void)disMissDialog{
    [SVProgressHUD dismiss];
}

+(void)showInfoWith:(NSString*)msg{
    [self setDefaultDialog];
    [SVProgressHUD showInfoWithStatus:msg];
    [self performSelector:@selector(disMissDialog) withObject:nil afterDelay:1.0f];
}

+(void)showSuccess:(NSString*)msg{
    [self setDefaultDialog];
    [SVProgressHUD showSuccessWithStatus:msg];
    [self performSelector:@selector(disMissDialog) withObject:nil afterDelay:1.0f];
}

+(void)showFailure:(NSString*)msg{
    [self setDefaultDialog];
    [SVProgressHUD showErrorWithStatus:msg];
    [self performSelector:@selector(disMissDialog) withObject:nil afterDelay:1.0f];
}

+(void)showProgressWithMsg:(NSString*)msg andEndProgress:(float)progress{
    [self setDefaultDialog];
    [SVProgressHUD showProgress:progress status:msg];
}

+(void)showProgressNotAllowUserWithMsg:(NSString*)msg andEndProgress:(float)progress{
    [self setDefaultDialog];
    [SVProgressHUD setDefaultMaskType:SVProgressHUDMaskTypeClear];
    [SVProgressHUD showProgress:progress status:msg];
}

+(void)showDialogWithImage:(NSString*)imageName andMessage:(NSString*)msg{
    [self setDefaultDialog];
    [SVProgressHUD setMinimumDismissTimeInterval:2];
    [SVProgressHUD showImage:[ImageUtil getImageByName:imageName] status:msg];
}

@end
